<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>Related Elements Example</title>
</head>

<body>
    <div id="myDiv" style="background-color:red;height:100px;width:100px;">
        你好
    </div>

    <script>
        var EventUtil = {
            //省略了其他代码
            getRelatedTarget: function(event) {
                if (event.relatedTarget) {
                    return event.relatedTarget;
                } else if (event.toElement) {
                    return event.toElement;
                } else if (event.fromElement) {
                    return event.fromElement;
                } else {
                    return null;
                }
            },
            //省略了其他代码
        };
    </script>
</body>

</html>